package com.liyiwei.design.decorator;

/**
 * 装饰者模式的优点：
 *  ①装饰着模式与继承关系的目的都是要扩展对象的功能，但是装饰者模式更加灵活。
 *  ②
 */
public class Client {

    public static void main(String[] args) {
        ConcreateComponet concreateComponet = new ConcreateComponet();
        Decotator decotatorA = new ConcreatADecotator(new ConcreateComponet());
        Decotator decotatorB = new ConcreatBDecotator(new ConcreateComponet());
        decotatorA.doOperation();
        decotatorB.doOperation();
        Decotator decotatorC = new ConcreatBDecotator(new ConcreatADecotator(new ConcreateComponet()));
        decotatorC.doOperation();

    }
}
